package com.h2View.controller;

import com.h2View.entity.MsgBox;
import com.h2View.utils.CacheUtil;
import com.h2View.utils.ToolConstant;
import com.xjw.annotation.FXController;
import com.xjw.annotation.FXRedirect;
import com.xjw.annotation.FXWindow;
import com.xjw.entity.FXBaseController;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.text.Font;
import javafx.scene.text.Text;

import java.net.URL;
import java.util.ResourceBundle;

/**
 * @author xwx1052336
 * @since iFad Platform V100R001,2021/9/10
 */
@FXController(path = "fxml/confirmBar.fxml")
@FXWindow(title = "确认页面", icon = "image/icon.png")
public class ConfirmBarController extends FXBaseController implements Initializable {


    @FXML
    private Text msgEle;

    private MsgBox msgBox;

    @Override
    public void onShow(){
        msgBox = CacheUtil.get(ToolConstant.CONFIRMBARKEY);
        Font font = new Font(15);
        msgEle.setFont(font);
        msgEle.setText(msgBox.getMsg());
    }

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        this.onScrollProperty().addListener((observable, oldValue, newValue) -> {
            System.out.println("newValue=="+newValue+"==oldValue=="+oldValue+"==observable=="+observable);
        });
    }

    @FXML
    @FXRedirect
    public String confirm(){
        msgBox.start();
        return msgBox.getSendUrl();
    }

    @FXML
    @FXRedirect
    public String cancel(){
        return msgBox.getSendUrl();
    }



}
